import PropTypes from "prop-types";

export default function Child(props) {
  console.log(props);
  return <div>Child...</div>;
}

// 对组件的属性进行类型约束
Child.propTypes = {
  name: PropTypes.string.isRequired, // 必选
  age: PropTypes.number, // 可选
  person: PropTypes.object.isRequired, // 必选
};

// 对组件的属性赋予默认值
Child.defaultProps = {
  age: 20,
};
